package com.hrm.houfei.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * 产生随机数类
 * 
 * @author Administrator
 * 
 */
public class CreatRandom {

	/**
	 * 为照片构造一个随机的名字
	 * 
	 * @param extendName
	 *            文件扩展名
	 * @return 返回一个随机图片名称
	 */
	public static String creatRandomImageName(String extendName) {
		Date date = new Date();
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMddkkmmss");
		String sdate = format.format(date);
		Random random = new Random();
		int number = random.nextInt(999999999);
		String randomImageName = "person" + sdate + number + extendName;
		return randomImageName;
	}
	public static String creatRandomImageName(String fileHead,String extendName) {
		Date date = new Date();
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMddkkmmss");
		String sdate = format.format(date);
		Random random = new Random();
		int number = random.nextInt(999999999);
		String randomImageName = fileHead + sdate + number + extendName;
		return randomImageName;
	}

	/**
	 * 产生一个人员档案信息随机编号
	 * 
	 * @return
	 */
	public static String createRandomPersonFileId() {
		Date date = new Date();
		// 年+月+日+时+分+秒+毫秒
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMddkkmmssSS");
		String sdate = format.format(date);
		Random random = new Random();
		int number = random.nextInt(999999999);
		String randomImageName = "PF" + sdate + number;
		return randomImageName;
	}

	/**
	 * 随机产生一个薪酬发放单编号
	 * @return
	 */
	public static String createRandomMoneyPaymentId() {
		Date date = new Date();
		// 年+月+日+时+分+秒+毫秒
		SimpleDateFormat format = new SimpleDateFormat("yyyyMMddkkmmssSS");
		String sdate = format.format(date);
		Random random = new Random();
		int number = random.nextInt(999999999);
		String randomImageName = "XCHFF" + sdate + number;
		return randomImageName;
	}
}
